<template>
  <div id="app">
    <div class="heart-container">
      <div class="heart" v-for="n in 5" :key="n">
        <span>{{ loveMessage }}</span>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  name: "LoveMessage",
  data() {
    return {
      loveMessage: "我爱你！",
    };
  },
};
</script>
 
<style scoped>
.heart-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.heart {
  position: relative;
  width: 100px;
  height: 90px;
  background: #f00;
  animation: beat 0.8s infinite;
}

.heart span {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 90px;
  background: #f00;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

@keyframes beat {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}
</style>